/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.caresms.service.impl;

import java.util.Collection;
import java.util.List;

import com.caresms.NoSuchKeyword_MasterException;
import com.caresms.model.Keyword_Master;
import com.caresms.model.Sms_Master;
import com.caresms.service.base.Keyword_MasterLocalServiceBaseImpl;
import com.liferay.portal.SystemException;


/**
 * The implementation of the keyword_ master local service.
 *
 * <p>
 * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.caresms.service.Keyword_MasterLocalService} interface.
 *
 * <p>
 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
 * </p>
 *
 * @author cc
 * @see com.caresms.service.base.Keyword_MasterLocalServiceBaseImpl
 * @see com.caresms.service.Keyword_MasterLocalServiceUtil
 */
public class Keyword_MasterLocalServiceImpl
	extends Keyword_MasterLocalServiceBaseImpl {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never reference this interface directly. Always use {@link com.caresms.service.Keyword_MasterLocalServiceUtil} to access the keyword_ master local service.
	 */
	public void addKey(long l,String str,boolean active)
	{
		long keyId=0l;
		try {
			keyId=counterLocalService.increment();
			Keyword_Master km=keyword_MasterPersistence.create(keyId);
			km.setKeyId(keyId);
			km.setCat_Id(l);
			km.setKeywordName(str);
			km.setIsActive(active);
			keyword_MasterPersistence.update(km, false);
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	@SuppressWarnings("deprecation")
	public List<Keyword_Master> getByCatId(long l) throws SystemException
	{
		return keyword_MasterFinder.findBycat(l);
	}
	public long getbykeyname(String keyname) throws SystemException
	{
		return keyword_MasterFinder.getByKeyname(keyname);	
	}
	public List<Sms_Master> getBysms(long kid) throws SystemException
	{
		return keyword_MasterFinder.findBykeyid(kid);
	}
	public List<Sms_Master> getSmsByCatid(long cid) throws SystemException
	{
		return keyword_MasterFinder.findSmsBycatid(cid);
	}
}